<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8 without BOM">
        <title>insert/update</title>
        <link rel="stylesheet" href="../../Public/css/960.css" type="text/css" media="screen" charset="utf-8" />
        <link rel="stylesheet" href="../../Public/css/template.css" type="text/css" media="screen" charset="utf-8" />
        <link rel="stylesheet" href="../../Public/css/colour.css" type="text/css" media="screen" charset="utf-8" />

        <script src="../../Public/js/mootools-core.js" type="text/javascript"></script>
        <script src="../../Public/js/mootools-more.js" type="text/javascript"></script>
        <script src="../../Public/js/Source/Locale.en-US.DatePicker.js" type="text/javascript"></script>
        <script src="../../Public/js/Source/Picker.js" type="text/javascript"></script>
        <script src="../../Public/js/Source/Picker.Attach.js" type="text/javascript"></script>
        <script src="../../Public/js/Source/Picker.Date.js" type="text/javascript"></script>
        <link href="../../Public/js/Source/datepicker.css" rel="stylesheet"/>


        <script type="text/javascript">
            function GetId(id)
            {
                return document.getElementById(id);
            }

            function ChkAddress(a)
            {
                x=GetId('msgCity');
                if(a.trim().length==0)
                {
                    x.style.display='block';
                }
                else x.style.display='none';
            }


            function ChkForm(form)
            {
                var count=0;
                with(form){
                    x=GetId('msgCity');
                    if(dtname.value.trim().length==0)
                    {
                        x.style.display='block';
                        count++;
                        //return false;
                    }
                    else x.style.display='none';


                }
                if(count==0 && confirm("Are you sure?"))
                {
                    return true;
                }
                else
                    return false;
            }

            window.addEvent('domready', function(){

                new Picker.Date($$('.birthDate'), {
                    toggle: $$('.myLink')
                });
            });
        </script>
    </head>
    <body>

        <?php
        include_once '../../Include/dbconnect.php';
        include_once '../../Model/user.php';
        include_once '../header.php';
        include_once '../menu.php';
        ?>

        <div id="content" class="container_16 clearfix">
            <div class="grid_16">
                <h2>
                    <span>insert/update</span>
                </h2>
            </div>
            <!-- Search -->
            <div id="ctl00_ContentPlaceHolder1_plSearch" >
                <form action="<?php
        if (isset($_GET['id']))
            echo "../../Controller/access.php?cmd=edit";
        else
            echo "../../Controller/access.php?cmd=add";
        ?>" method="post">
                    <div class="grid_5">
                        <span> ID:</span>
                        <input type="text" name="dtid" readonly="readonly" id="dtid"
                               value="<?php if (isset($_GET['id']))
                          echo $_GET['id']; ?>"/>
                    </div>
                    <div class="grid_5">
                        <span>Họ Và Tên:</span>
                        <input type="text" name="dtname" onblur="ChkAddress(this.value)" id="dtname"
                               value="<?php if (isset($_GET['name']))
                                   echo $_GET['name']; ?>"/>
                        <span id="msgCity" style="display: none;color: red">Object is required</span>

                    </div>
                   <div class="grid_5">
                    <span>Ngày Sinh:</span>
                    <input type="text" name="birthday" id="birthday" readonly="readonly" class="birthDate"
                           value="<?php if (isset($_GET['birthday']))
                                   echo date_format(new DateTime($_GET['birthday']), "d/m/Y"); ?>"/>
                    <span id="msgC1" ><a class="myLink">Calendar</a></span>
              </div>
                    <div class="grid_2">
                        <span>Giới Tính:</span>
                        <select name ="sex" id="sex" >
                            <option value="0" <?php if (isset($_GET['sex']) && $_GET['sex']=="0") echo "selected = 'selected'"?>>Nữ</option>
                            <option value="1" <?php if (isset($_GET['sex']) && $_GET['sex']=="1") echo "selected = 'selected'"?>>Nam</option>
                        </select>


                    </div>
                    <div class="grid_10">
                        <span>Nghề Nghiệp:</span>
                        <input type="text" name="job" onblur="ChkAddress(this.value)" id="job"
                               value="<?php if (isset($_GET['job']))
                                   echo $_GET['job']; ?>"/>
                        <span id="msgCity" style="display: none;color: red">Object is required</span>

                    </div>


                    <div class="grid_4">
                        <br/>

                        <input type="submit" value="<?php
                               if ($_GET['id'])
                                   echo "Edit";
                               else
                                   echo "Add new";
        ?>" onclick="return ChkForm(this.form)">
                    </div>
                </form>

            </div>
            <!-- end  Search -->
          

            </div>
        <?php
                                include_once '../footer.php';
        ?>

    </body>
</html>
